<template>
	<view class="">
		<view class="resume_tsfw">
			<view class="resume_text">
				我的简历
			</view>
			<view class="resume_my" v-if="MyDatashow" v-for="(item,index) in resumeMyData" :key="index">
				<view class="resume_my_box" v-if="resumeMyData.length">
					<view class="resume_my_left" @click="GoMyresume(index)" >
						<view class="resume_my_img">
							<image :src="item.tx" mode=""></image>
						</view>
						<view class="resume_my_text">
							<view class="resume_text_name" @click.stop="jlmcxg(index)">
								{{item.jlmc || "中国匠工"}}
								<u-icon name="edit-pen" color="#808080" size="30" style="margin-left: 15rpx;"></u-icon>
							</view>
 
							<view class="resume_text_label">
								<text>{{item.grjb|| "暂无"}}</text><!-- <text>随时到岗</text> -->
							</view>
							<view class="resume_text_time">
								<text>{{item._updatetime||"暂无"}}</text>
							</view>
						</view>
					</view>
					<u-popup v-model="show" mode="bottom" v-if="indexc == index">
						<u-form :model="form" ref="uForm" style="padding:30rpx;">
							<u-form-item label="简历名称" prop="xm" label-width="150" style="margin-bottom: 30rpx;">
								<u-input v-model="form.jlmcc" :placeholder="item.jlmc" />
							</u-form-item>
							<u-button @click="submit(index)" style="margin:0 100rpx;background-color: rgb(0, 192, 145);color: #fff;">提交</u-button>
						</u-form>
					</u-popup>

					<view class="resume_my_ico">
						<u-icon name="trash" color="#808080" size="35" @click="Delete(item.id)"></u-icon>
					</view>
				</view>
				<view class="resume_my_notice">
					<u-icon name="bell" color="#00C091" size="30"></u-icon><text>去PC端编辑简历效率更高哟~~</text>
					<view class="resume_my_pc">
						去PC端
					</view>
				</view>
			</view>

			<view class="resume_my" v-if="!MyDatashow" @click="Goresume">
				<view class="resume_new">
					<u-icon name="plus" color="#18B566" size="30" style="margin-right: 15rpx;"></u-icon>新建/导入简历
				</view>
			</view>
		</view>
		<u-toast ref="uToast" />

	</view>
</template>

<script>
	export default {
		data() {
			return {
				show: false,
				indexc:0,
				form: {
					jlmcc: ""
				},
				mbbmmb:"rslTheme1",
				rslThemeData: {
					"rslTheme1": {
						"leftbox": ["rsclogo", "rscbase"],
						"rightbox": ["rscname", "rsczwpj", "rscwhere", "rscgcal", "rscjyjl", "rscgzjl"]
					},
					"rslTheme2": {
						"topbox": ["rsclogo", "rscname"],
						"bottombox": ["rscbase", "rsczwpj", "rscwhere", "rscgcal", "rscjyjl", "rscgzjl"]
					},
					"rslTheme3": {
						"topbox": ["rsclogo", "rscname"],
						"bottombox": ["rscbase", "rsczwpj", "rscwhere", "rscgcal", "rscjyjl", "rscgzjl"]
					},
					"rslTheme4": {
						"topbox": ["rsclogo", "rscname"],
						"bottombox": ["rscbase", "rsczwpj", "rscwhere", "rscgcal", "rscjyjl", "rscgzjl"]
					},
					"rslTheme5": {
						"topbox": ["rscname", "rsclogo"],
						"leftbox": ["rscbase"],
						"rightbox": ["rsczwpj", "rscwhere", "rscgcal", "rscjyjl", "rscgzjl"],
					},
				
				},
			}
		},
		props: {
			resumeMyData: {
				type: Array,
				default () {
					return []
				}
			},
			MyDatashow: {
				type: Boolean,
				required: false
			}
		},
		methods: {
			jlmcxg(index) {
				this.indexc=index
				this.show = true
			},
			GoMyresume(index) {
				this.$u.route('/pages/HomeLnner/ResumeEdit/ResumeEdit', {
					id: this.resumeMyData[index].id
				})
			},
			async submit(index) {
				let $t = this
				$t.$forceUpdate()
				let params = {
					ak: this.$store.state.token,
					cmd: 'lPeople_myupdate',
					para: {
						"jlmc": this.form.jlmcc,
						"id": this.resumeMyData[index].id
					}
				}
				const res = await this.$u.api.resumexgdata(params)
				if (res.ResponseID == 0) {
					this.show = false
					this.$refs.uToast.show({
						title: res.Message,
						icon: false,
						duration: 800,
						callback() {
							$t.$emit("getChild1", "1");
						}
					})
				}
			},
			async Delete(id) {
				let $t = this
				let params = {
					ak: this.$store.state.token,
					cmd: 'lPeople_mydelete',
					para: {
						id: id,
					}
				}
				const res = await this.$u.api.resumedata(params)
				if (res.ResponseID == 0) {
					this.$refs.uToast.show({
						title: res.Message,
						icon: false,
						duration: 800,
						callback() {
							$t.$emit("getChild1", "1");
						}
					})
				}

			},
			async Goresume() {
				if (this.$store.state.token) {
					let params = {
						ak: this.$store.state.token,
						cmd: 'lPeople_add',
						para: {
							"xm": "",
							"lxdh": "",
							thmid: this.mbbmmb,
							thmconfig: JSON.stringify(this.rslThemeData[this.mbbmmb]),
						}
					}
					const res = await this.$u.api.resumexgdata(params)
					if (res.Data.id) {
						this.$u.route('/pages/HomeLnner/ResumeEdit/ResumeEdit', {
							id: res.Data.id
						})
					}
				} else {
					this.$u.route('/pages/myuser/user/UserInfo')
				}

			}
		},
	}
</script>

<style scoped lang="scss">
	.resume_tsfw {
		padding: 40rpx 30rpx 0 30rpx;

		.resume_text {
			font-size: 32rpx;
			font-weight: bold;
		}

		.resume_my {
			margin-top: 30rpx;
			width: 100%;
			height: 280rpx;
			background: #FFFFFF;
			box-shadow: 0rpx 2rpx 21rpx 0rpx rgba(3, 165, 125, 0.36);
			border-radius: 10rpx;
			padding: 35rpx;

			.resume_new {
				font-size: 32rpx;
				text-align: center;
				line-height: 200rpx;
				color: #18B566;

				/deep/.uicon-plus {
					border-radius: 50%;
					border: 2rpx solid #18B566;
				}
			}

			.resume_my_box {
				display: flex;

				.resume_my_left {
					flex: 1;
					display: flex;
				}

				.resume_my_img {
					margin-right: 35rpx;
					width: 113rpx;
					height: 140rpx;
					background-color: #18B566;

					image {
						width: 100%;
						height: 100%;
					}
				}

				.resume_my_text {
					flex: 1;
					display: flex;
					flex-direction: column;
					justify-content: space-around;

					.resume_text_name {
						font-size: 30rpx;
						color: #000000;
					}

					.resume_text_label {
						text {
							font-size: 18rpx;
							padding: 5rpx;
							border-radius: 5rpx;

							&:first-child {
								background: #EDFFFB;
								color: #00C091;
								margin-right: 20rpx;
							}

							&:last-child {
								background: #FFF9F3;
								color: #FFA75E;
							}
						}
					}

					.resume_text_time {
						font-size: 20rpx;
						color: #999999;
					}
				}
			}

			.resume_my_notice {
				height: 50rpx;
				background: #EDFFFB;
				border-radius: 25rpx;
				margin-top: 24rpx;
				display: flex;
				justify-content: space-between;
				padding-left: 34rpx;
				line-height: 50rpx;

				text {
					flex: 1;
					margin-left: 15rpx;
					font-size: 20rpx;
					color: #00C091;
				}

				.resume_my_pc {
					padding: 0 24rpx;
					height: 50rpx;
					background: #00C091;
					border-radius: 25rpx;
					font-size: 22rpx;
					color: #FFFFFF;
				}
			}
		}

	}
</style>
